-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added feature: Header auto hide and unhide as user scroll. #363
Conversation
} | ||
|
||
// remember current page location to use in the next move | ||
setLastScrollY(window.scrollY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this not causing an infinite loop?
You're updating the lastScrollY
here and have it as a dependency to the effect?
Is it because it's the same the second time?
Doesn't matter but we should confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you are correct it is causing an issue. Actually I had added the useCallback after I was done testing the change. And then forgot to test again. Will correct and update. Sorry for the inconvinience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still dont see a useCallback here?
This will cause the effect to run on every render
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but using useCallback was causing infinite loop and it was not rendering that's why I removed that.
@hkirat I have resolved the issue and now it's working fine as I have tested it. Kindly have a look. Thanks ! |
@hkirat can you have a look please. If all good I can merge |
@hkirat pls have a look |
not needed I think, this got added in dailycode and becomes jarring if anything |
PR Fixes:
Resolves #361
Checklist before requesting a review